package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageQuality;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import game.manager.ConfigurationManager;
	import starling.core.Starling;
	
	/**
	 * @author Kirill Pletnev
	 */
	public class Startup extends Sprite
	{
		private var _starling:Starling;
		
		public function Startup():void
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			stage.quality = StageQuality.HIGH;
			stage.addEventListener(MouseEvent.RIGHT_CLICK, onRightClick);
			
			_starling = new Starling(Game, stage);
			_starling.enableErrorChecking = true;
			_starling.start();
			
			// this event is dispatched when stage3D is set up
			stage.stage3Ds[0].addEventListener(Event.CONTEXT3D_CREATE, onContextCreated);
		}
		
		private function onContextCreated(event:Event):void
		{
			SplashScreen.instance.show();
		}
		
		private function onRightClick(event:MouseEvent):void
		{
			//do nothing...
		}
	}
}